<template>
<div>
  <el-form ref="menu" :model="menu" label-width="80px">
    <el-row>



    <el-form-item label="菜单名称">
      <el-input v-model="menu.title"></el-input>
    </el-form-item>

    <el-form-item label="菜单路径">
      <el-input v-model="menu.path"></el-input>
    </el-form-item>

      <el-form-item label="父菜单id">
        <el-input v-model="menu.parentid"></el-input>
      </el-form-item>

      <el-form-item label="图标">
        <el-input v-model="menu.icon"></el-input>
      </el-form-item>
    </el-row>

    <el-form-item style="align-content: center">
      <el-button type="primary" @click="onSubmit">确定</el-button>
      <el-button @click="cancal">  取消</el-button>
    </el-form-item>
  </el-form>
</div>
</template>

<script>
import instance from "../../utils/request";

export default {
props:['dialogVisible'],

  name: "AddMenu",
  data() {
    return {
      // props:{dialogVisible},
      // props:['dialogVisible'],
      menu: {
        id: '',
        title: '',
        path: '',
        parentid: '',
        icon: ''
      }
    }
  },
  methods: {
    onSubmit() {

      instance.post("/addMenu",this.menu).then(res=>{
        alert("添加成功");
        console.log(this.dialogVisible);
        this.$emit('closeDialog');
        // this.getDialog.close();
      }).catch(err=>{
        alert("服务器错误，请联系管理员");
      })
    },
    cancal(){
      this.$emit('closeDialog');
    }
  },

}
</script>

<style scoped>

</style>
